package com.pc.mapper;

import com.pc.pojo.SysPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface SysPermissionMapper {

    @Select("SELECT p.* FROM sys_permission p " +
            "INNER JOIN role_perm_rel rp ON p.perm_id = rp.perm_id " +
            "INNER JOIN user_role_rel ur ON rp.role_id = ur.role_id " +
            "WHERE ur.user_id = #{userId}")
    List<SysPermission> selectPermissionsByUserId(Long userId);
}
